/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import entity.Inversor;
import java.util.List;
import javax.persistence.PersistenceContext;

/**
 *
 * @author ari
 */
@Stateless
public class BeanInversor implements BeanInversorRemote {
    @PersistenceContext(unitName = "BolsaValor-ejbPU")
    private EntityManager em;

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")

    @Override
    public boolean isUsuario(String login, String clave) {
        
        List<Inversor> invs = em.createQuery("select i from Inversor i", Inversor.class) //  where login = :login and clave = :clave
                //.setParameter(":login", login)
                //.setParameter(":clave", clave)
                .getResultList();
        if(invs.isEmpty())
            return false;
        
        return true;
    }

    public void persist(Object object) {
        em.persist(object);
    }
    
}
